package StudyCode.summary.mydatetime;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class SimpleDateFormatHour {
	public static void main(String[] args) {
		Date date = new Date();

		String strDateFormat = "h";
		SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);

		System.out.println("小时以 h 格式格式化: " + sdf.format(date));

		strDateFormat = "hh";
		sdf = new SimpleDateFormat(strDateFormat);

		System.out.println("小时以 hh 格式格式化: " + sdf.format(date));

		strDateFormat = "H";
		sdf = new SimpleDateFormat(strDateFormat);

		System.out.println("小时以 H 格式格式化: " + sdf.format(date));

		strDateFormat = "HH";
		sdf = new SimpleDateFormat(strDateFormat);

		System.out.println("小时以 HH 格式格式化: " + sdf.format(date));

		strDateFormat = "k";
		sdf = new SimpleDateFormat(strDateFormat);

		System.out.println("小时以 k 格式格式化: " + sdf.format(date));

		strDateFormat = "kk";
		sdf = new SimpleDateFormat(strDateFormat);

		System.out.println("小时以 kk 格式格式化: " + sdf.format(date));

		strDateFormat = "K";
		sdf = new SimpleDateFormat(strDateFormat);

		System.out.println("小时以 K 格式格式化: " + sdf.format(date));

		strDateFormat = "KK";
		sdf = new SimpleDateFormat(strDateFormat);

		System.out.println("小时以 KK 格式格式化: " + sdf.format(date));
	}
}
